<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://localhost" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://localhost" elementFormDefault="qualified">
  <xs:element name="report">
    <xs:annotation>
      <xs:documentation xml:lang="ro">Raportare pentru centrele de dializă privată</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
				<xs:element name="HDs" minOccurs="0">
					<xs:annotation>
						<xs:documentation xml:lang="ro">Lista de servicii de hemodializă</xs:documentation>
					</xs:annotation>
					<xs:complexType>
						<xs:sequence>
							<xs:element name="HD" maxOccurs="unbounded" minOccurs="0">
								<xs:annotation>
									<xs:documentation xml:lang="ro">Serviciu de hemodializă raportat</xs:documentation>
								</xs:annotation>
								<xs:complexType>
									<xs:sequence>
										<xs:element name="ForeignPerson" minOccurs="0" maxOccurs="1">
											<xs:annotation>
												<xs:documentation xml:lang="ro">
													Persoana straina.
												</xs:documentation>
											</xs:annotation>
											<xs:complexType>
												<xs:attribute name="personIdentifier" type="xs:string" use="required">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Codul de identificare al persoanei staine.
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="personFirstName" type="xs:string" use="required">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Prenumele persoanei straine.
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="personLastName" type="xs:string" use="required">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Numele persoanei strine.
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="birthDate" type="xs:date" use="required">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Data de nastere a persoanei straine.
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="countryCode" type="xs:string" use="optional">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Codul tarii cetateniei persoanei straine.
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="cardCode" type="xs:string" use="optional">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Codul cardului de asigurat al persoanei straine.
															(In cazul in care persoana are card de asigurare european)
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="cardExpireDate" type="xs:date" use="optional">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Data de expirare a cardului de asigurare.
															(In cazul in care persoana are card de asigurare european)
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="emissiveOrgUnitCode" type="xs:string" use="optional">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Codul unitatii care a emis cardul de asigurare.
															(In cazul in care persoana are card de asigurare european)
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="emissiveOrgUnitName" type="xs:string" use="optional">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Numele unitatii care a emis cardul de asigurare.
															(In cazul in care persoana are card de asigurare european)
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
												<xs:attribute name="emissiveOrgUnitAddress" type="xs:string" use="optional">
													<xs:annotation>
														<xs:documentation xml:lang="ro">
															Adresa unitatii care a emis cardul de asigurare.
															(In cazul in care persoana are card de asigurare european)
														</xs:documentation>
													</xs:annotation>
												</xs:attribute>
											</xs:complexType>
										</xs:element>
										<xs:element name="HDDate" minOccurs="0" maxOccurs="unbounded">
											<xs:annotation>
												<xs:documentation xml:lang="ro">Data la care s-a facut o sedinta de hemodializa.</xs:documentation>
											</xs:annotation>
											<xs:complexType >
												<xs:attribute name="date" type="xs:date" />
											</xs:complexType>
										</xs:element>
									</xs:sequence>
									<xs:attribute name="pid" use="optional">
										<xs:annotation>
											<xs:documentation xml:lang="ro">CNP-ul persoanei</xs:documentation>
										</xs:annotation>
										<xs:simpleType>
											<xs:restriction base="xs:string">
												<xs:maxLength value="13" />
												<xs:minLength value="13" />
												<xs:pattern value="[0-9]{13}" />
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
									<xs:attribute name="noHospitalFileDay" use="required">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Numărul de zile de spitalizare raportate</xs:documentation>
										</xs:annotation>
										<xs:simpleType>
											<xs:restriction base="xs:string">
												<xs:maxLength value="10" />
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
									<xs:attribute name="noReportedHemSession" type="xs:short" use="required">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Numărul de sesiuni de hemodializă raportate</xs:documentation>
										</xs:annotation>
									</xs:attribute>
									<xs:attribute name="sessionCharge" type="xs:double" use="required">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Tarif pe sesiune</xs:documentation>
										</xs:annotation>
									</xs:attribute>
									<xs:attribute name="reportedRefoundSumE" type="xs:double" use="required">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Sumă decontată</xs:documentation>
										</xs:annotation>
									</xs:attribute>
									<xs:attribute name="validFrom" type="xs:date" use="optional">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Data de inceput a valabilităţii</xs:documentation>
										</xs:annotation>
									</xs:attribute>
									<xs:attribute name="validTo" type="xs:date" use="optional">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Data de sfârşit a valabilităţii</xs:documentation>
										</xs:annotation>
									</xs:attribute>
									<xs:attribute name="obs" type="xs:string" use="optional">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Observaţii</xs:documentation>
										</xs:annotation>
									</xs:attribute>
									<xs:attribute name="temporaryTransfer" type="xs:boolean" use="required">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Flag care specifică dacă este transfer temporar</xs:documentation>
										</xs:annotation>
									</xs:attribute>
									<xs:attribute name="AppID" type="xs:string">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Identificatorul unic al înregistrării</xs:documentation>
										</xs:annotation>
									</xs:attribute>
									<xs:attribute name="personType"  use="optional">
										<xs:annotation>
											<xs:documentation xml:lang="ro">Tipul pacientului.</xs:documentation>
										</xs:annotation>
										<xs:simpleType>
											<xs:restriction base="xs:string">
												<xs:enumeration value="ASIGURAT">
													<xs:annotation>
														<xs:documentation xml:lang="ro">Asigurati</xs:documentation>
													</xs:annotation>
												</xs:enumeration>
												<xs:enumeration value="CARD_EURO">
													<xs:annotation>
														<xs:documentation xml:lang="ro">Persoane titulare ale cardului european</xs:documentation>
													</xs:annotation>
												</xs:enumeration>
												<xs:enumeration value="CETA_CONV">
													<xs:annotation>
														<xs:documentation xml:lang="ro">Cetatenii statelor cu care Romania a incheiat intelegeri, conventii sau protocoale internationale</xs:documentation>
													</xs:annotation>
												</xs:enumeration>
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
        <xs:element name="DPs" minOccurs="0">
          <xs:annotation>
            <xs:documentation xml:lang="ro">Lista de servicii de dializă peritoneală raportate</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="DP" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                  <xs:documentation xml:lang="ro">Serviciu de dializă peritoneală raportate</xs:documentation>
                </xs:annotation>
                <xs:complexType>     
                  <xs:sequence>				  
	              <xs:element name="ForeignPerson" minOccurs="0" >
					    <xs:annotation>
						    <xs:documentation xml:lang="ro">
							    Persoana straina.
					        </xs:documentation>
						</xs:annotation>
						<xs:complexType>									
						    <xs:attribute name="personIdentifier" type="xs:string" use="required">
							    <xs:annotation>
								    <xs:documentation xml:lang="ro">
									    Codul de identificare al persoanei staine.
						  	        </xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="personFirstName" type="xs:string" use="required">
							    <xs:annotation>
								    <xs:documentation xml:lang="ro">
									    Prenumele persoanei straine.
							        </xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="personLastName" type="xs:string" use="required">
							    <xs:annotation>
								    <xs:documentation xml:lang="ro">
							 		   Numele persoanei strine.
							 	    </xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="birthDate" type="xs:date" use="required">
								<xs:annotation>
									<xs:documentation xml:lang="ro">
					  				    Data de nastere a persoanei straine.
									</xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="countryCode" type="xs:string" use="optional">
								<xs:annotation>
									<xs:documentation xml:lang="ro">
										Codul tarii cetateniei persoanei straine.
									</xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="cardCode" type="xs:string" use="optional">
								<xs:annotation>
								    <xs:documentation xml:lang="ro">
										Codul cardului de asigurat al persoanei straine.
										(In cazul in care persoana are card de asigurare european)
									</xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="cardExpireDate" type="xs:date" use="optional">
								<xs:annotation>
									<xs:documentation xml:lang="ro">
										Data de expirare a cardului de asigurare.
										(In cazul in care persoana are card de asigurare european)
									</xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="emissiveOrgUnitCode" type="xs:string" use="optional">
								<xs:annotation>
									<xs:documentation xml:lang="ro">
										Codul unitatii care a emis cardul de asigurare.
										(In cazul in care persoana are card de asigurare european)
									</xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="emissiveOrgUnitName" type="xs:string" use="optional">
								<xs:annotation>
									<xs:documentation xml:lang="ro">
										Numele unitatii care a emis cardul de asigurare.
										(In cazul in care persoana are card de asigurare european)
									</xs:documentation>
								</xs:annotation>
							</xs:attribute>
							<xs:attribute name="emissiveOrgUnitAddress" type="xs:string" use="optional">
								<xs:annotation>
									<xs:documentation xml:lang="ro">
										Adresa unitatii care a emis cardul de asigurare.
										(In cazul in care persoana are card de asigurare european)
									</xs:documentation>
								</xs:annotation>
							</xs:attribute>
						</xs:complexType>
				  </xs:element>	
                 </xs:sequence>				  				
                  <xs:attribute name="pid" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">CNP-ul persoanei</xs:documentation>
                    </xs:annotation>
					 <xs:simpleType>
                         <xs:restriction base="xs:string">
                           <xs:maxLength value="13" />
                           <xs:minLength value="13" />
                           <xs:pattern value="[0-9]{13}" />
                         </xs:restriction>					
				      </xs:simpleType>										
                  </xs:attribute>
                  <xs:attribute name="noHospitalFileDay" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul de zile de spitalizare raportate</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="10" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="reportedRefoundSumE" type="xs:double" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul de sesiuni de hemodializă raportate</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="validFrom" type="xs:date" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data de inceput a valabilităţii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="validTo" type="xs:date" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data de sfârşit a valabilităţii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="obs" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Observaţii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="AppID" type="xs:string">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Identificatorul unic al înregistrării</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="personType" use="optional">
                     <xs:annotation>
                         <xs:documentation xml:lang="ro">Tipul pacientului.</xs:documentation>
                     </xs:annotation>
					 <xs:simpleType>
					    <xs:restriction base="xs:string">
							<xs:enumeration value="ASIGURAT">
								<xs:annotation>
									<xs:documentation xml:lang="ro">Asigurati</xs:documentation>
						  	    </xs:annotation>
							</xs:enumeration>							
						    <xs:enumeration value="CARD_EURO">
								<xs:annotation>
									<xs:documentation xml:lang="ro">Persoane titulare ale cardului european</xs:documentation>
								</xs:annotation>
							</xs:enumeration>
							<xs:enumeration value="CETA_CONV">
								<xs:annotation>
									<xs:documentation xml:lang="ro">Cetatenii statelor cu care Romania a incheiat intelegeri, conventii sau protocoale internationale</xs:documentation>
								</xs:annotation>
							</xs:enumeration>
						</xs:restriction>
					</xs:simpleType>				
                  </xs:attribute>											  
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="provider" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Denumire furnizor de servicii</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="fiscalCode" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Codul fiscal al furnizorului</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="contractNo" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Numărul de contract al furnizorului</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="insuranceHouse" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Casa de asigurări cu care s-a încheiat contractul</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="reportingDate" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Data raportării</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="startFrom" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Data de început a perioadei de raportare</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="endTo" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Data de sfârşit a perioadei de raportare</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="supervisorStencilNo" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Numărul de parafă al medicului coordonator</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="AppKey" type="xs:string" use="optional">
        <xs:annotation>
					<xs:documentation xml:lang="en">3rd partry software provider product key</xs:documentation>
					<xs:documentation xml:lang="ro">Cheia de identificare a aplicaţiei de raportare (producator de software 3rd partry)</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="AppID" type="xs:string" use="optional">
        <xs:annotation>
					<xs:documentation xml:lang="en">Unique identifier of report</xs:documentation>
          <xs:documentation xml:lang="ro">Identificatorul unic al raportării în cadrul aplicaţiei de raportare</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="invoiceNo" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice number</xs:documentation>
          <xs:documentation xml:lang="ro">Numar factura</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="invoiceDate" type="xs:date" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice date</xs:documentation>
          <xs:documentation xml:lang="ro">Data factura</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="invoiceValue" type="xs:decimal" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice amount</xs:documentation>
          <xs:documentation xml:lang="ro">Valoare factura</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="isCorrection" type="xs:string" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Flag care specifică dacă raportarea este de corecţie</xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
</xs:schema>